
# 定义一个类，内含私有成员变量和私有成员方法
"""
class Phone:

    __current_voltage = 0

    def __keep_single_core(self):
        print("让CPU以单核模式运行")

    def call_by_5g(self):
        if self.__current_voltage >= 1:
            print("success")
        else:
            self.__keep_single_core()
            print("电量不足，无法使用5g通话，并已设置为单核运行")

phone = Phone()
# phone.__keep_single_core()
# print(phone.__current_voltage)
phone.call_by_5g()
"""
# homework
class Phone:
    __is_5g_enable = False
    def __check_5g(self):
        if self.__is_5g_enable == True:
            print("5G is opening")
        else:
            print("5G is closing,4G is being used")
    def call_by_5g(self):
        self.__check_5g()
        print("be calling")

phone = Phone()
phone.call_by_5g()
